/**
 * 省市区三级数据 根据id  返回name拼接
 * 
 * */ 
export function getRegionNameById(addressOptions, regionData) {
    const { regionProvinceId, regionCityId, regionDistrictId } = regionData;
  
    if(!regionProvinceId){
      return ''
    }
  
    // 找到省份
    const selectedProvince = addressOptions.find(province => province.id === regionProvinceId);
    if (!selectedProvince) {
        return ''
    }
  
    // 找到城市
    const selectedCity = selectedProvince.children.find(city => city.id === regionCityId);
    if (!selectedCity) {
        return ''
    }
  
    // 找到区县
    const selectedDistrict = selectedCity.children.find(district => district.id === regionDistrictId);
    if (!selectedDistrict) {
        return ''
    }
  
    // 返回拼接的名称
    return `${selectedProvince.name}-${selectedCity.name}-${selectedDistrict.name}`;
  }